package com.yanqu.road.server.cmd.player;

import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.servercenter.ServerInfo;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.manger.PlatformUserIdMgr;
import com.yanqu.road.server.manger.ServerListMgr;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2021/8/19 17:44
 */
@Cmd(code = GameProtocol.S_LUNTAN_LOGIN, desc = "自营论坛登录")
public class LunTanLoginCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ServerInfo serverInfo = ServerListMgr.getServerInfo(GameServer.getInstance().getServerId());
        if(PlatformUserIdMgr.openBehavior(1,serverInfo )){
            return;
        }
        player.notifyListener(eGamePlayerEventType.LunTanLoginTimes.getValue(), 1);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
